<template>
  <div class="_flex _flex-a-start">
    <div class="_wrapper-y _cart _m-r-10 _radius-5p">
      <div
        class="_font-title _text-a-c _wrapper-x _background-3 _p5 _radius-5p"
      >
        收藏
      </div>
      <div class="_flex-y _flex-a-start _flex-space-10">
        <template
          v-for="app in loginApps.filter((item) => item.data.is_core === '1')"
          :key="app.name"
        >
          <app
            :text="app.name"
            :imgSrc="app.icon"
            @click="$comStore.comWin.openWin(app)"
          ></app>
        </template>
      </div>
    </div>
    <!-- <div class="_flex _flex-wrap _flex-start"> -->
    <div class="_wrapper">
      <Apps :apps="loginApps" :pid="0" @openWin="$comStore.comWin.openWin" />
      <template
        v-for="app in loginApps.filter(
          (item) => item.data.pid == 0 && !item.data.resource_id
        )"
        :key="app.name"
      >
        <Apps
          :apps="loginApps"
          :pid="app.data.id"
          :blockName="app.name"
          @openWin="$comStore.comWin.openWin"
        />
      </template>
    </div>
  </div>
</template>
<script>
import Apps from "./apps.vue";
import App from "./app.vue";
export default {
  components: { Apps, App },
  computed: {
    loginApps() {
      return this.$comStore.login.loginRes.map((res) => {
        res.com_resource = res.com_resource || {};
        return {
          name: res.name,
          code: res.com_resource.content,
          icon: res.icon !== "#" ? res.icon : undefined,
          data: res,
        };
      });
    },
  },
};
</script>
<style scoped></style>
